package com.jp.knowledge.model;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

import java.util.Comparator;

/**
 * Created by jiayen on 16/11/16.
 *
 * 搜索关键字缓存
 */
@Table(name = "search_history")
public class SearchKey extends  BaseDb implements Comparator<SearchKey>{

    @Column(name = "KEY", property = "NOT NULL")
    private String name;
    @Column(name = "SEARCH_TIME", property = "NOT NULL")
    private long searchTime;

    public long getSearchTime() {
        return searchTime;
    }

    public void setSearchTime(long searchTime) {
        this.searchTime = searchTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int compare(SearchKey o1, SearchKey o2) {
        if(o1.getSearchTime() < o2.getSearchTime())
            return 1;
        else if(o1.getSearchTime() > o2.getSearchTime())
            return -1;
        else
            return 0;
    }
}
